<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>第7章：函数与作用域 | MarkDown的使用</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../JavaScript/JavaScript_8.html" />
    
    
    <link rel="prev" href="../JavaScript/JavaScript_6.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="5.7"
        data-chapter-title="第7章：函数与作用域"
        data-filepath="JavaScript/JavaScript_7.md"
        data-basepath=".."
        data-revision="Sat Nov 10 2018 16:39:50 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="HTML/html_int.html">
            
                
                    <a href="../HTML/html_int.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML5简介
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="HTML/gitbook_use.html">
            
                
                    <a href="../HTML/gitbook_use.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        第0章：gitbook的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="HTML/lesson1.html">
            
                
                    <a href="../HTML/lesson1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        第1章：常用标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="HTML/lesson2.html">
            
                
                    <a href="../HTML/lesson2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        第2章：列表与图片
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="HTML/lesson3.html">
            
                
                    <a href="../HTML/lesson3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        第3章：表格与表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="HTML/lesson4.html">
            
                
                    <a href="../HTML/lesson4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        第4章：实体字符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="HTML/lesson5.html">
            
                
                    <a href="../HTML/lesson5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        第5章：多媒体和iframe
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="CSS/css_int.html">
            
                
                    <a href="../CSS/css_int.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS简介
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="CSS/css_1.html">
            
                
                    <a href="../CSS/css_1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        第1章：引入css
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="CSS/css_2.html">
            
                
                    <a href="../CSS/css_2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        第2章：选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="CSS/css_3.html">
            
                
                    <a href="../CSS/css_3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        第3章：属性选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="CSS/css_4.html">
            
                
                    <a href="../CSS/css_4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        第4章：伪类选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="CSS/css_5.html">
            
                
                    <a href="../CSS/css_5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        第5章：盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="CSS/css_6.html">
            
                
                    <a href="../CSS/css_6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        第6章：伪对象选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="CSS/css_7.html">
            
                
                    <a href="../CSS/css_7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        第7章：font字体与边框
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="CSS/css_8.html">
            
                
                    <a href="../CSS/css_8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        第8章：行高
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="CSS/css_9.html">
            
                
                    <a href="../CSS/css_9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        第9章：文字与背景
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="CSS/css_10.html">
            
                
                    <a href="../CSS/css_10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        第10章：浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="CSS/css_11.html">
            
                
                    <a href="../CSS/css_11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        第11章：定位与渐变
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="CSS/css_12.html">
            
                
                    <a href="../CSS/css_12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        第12章：css过渡与变形
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="CSS/css_13.html">
            
                
                    <a href="../CSS/css_13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        第13章：css动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="CSS/css_14.html">
            
                
                    <a href="../CSS/css_14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.</b>
                        
                        第14章：css滤镜
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="CSS/css_15.html">
            
                
                    <a href="../CSS/css_15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.</b>
                        
                        第15章：swiper与地图插件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="CSS/css_16.html">
            
                
                    <a href="../CSS/css_16.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.16.</b>
                        
                        第16章：移动端rem布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="CSS/css_17.html">
            
                
                    <a href="../CSS/css_17.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.17.</b>
                        
                        第17章：伸缩盒子
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="SASS/sass_int.html">
            
                
                    <a href="../SASS/sass_int.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        sass简介
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="SASS/sass_1.html">
            
                
                    <a href="../SASS/sass_1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        第1章：sass安装与使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="SASS/sass_2.html">
            
                
                    <a href="../SASS/sass_2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        第2章：sass语法入门
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="Bootstrap/Bootstrap_int.html">
            
                
                    <a href="../Bootstrap/Bootstrap_int.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        Bootstrap简介
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="Bootstrap/Bootstrap_1.html">
            
                
                    <a href="../Bootstrap/Bootstrap_1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        第1章：Bootstrap
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="JavaScript/JavaScript_int.html">
            
                
                    <a href="../JavaScript/JavaScript_int.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        JavaScript简介
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="JavaScript/JavaScript_1.html">
            
                
                    <a href="../JavaScript/JavaScript_1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        第1章：JavaScript
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="JavaScript/JavaScript_2.html">
            
                
                    <a href="../JavaScript/JavaScript_2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        第2章：变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="JavaScript/JavaScript_3.html">
            
                
                    <a href="../JavaScript/JavaScript_3.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        第3章：Number
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="JavaScript/JavaScript_4.html">
            
                
                    <a href="../JavaScript/JavaScript_4.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        第4章：数据类型判断
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="JavaScript/JavaScript_5.html">
            
                
                    <a href="../JavaScript/JavaScript_5.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        第5章：运算符与字符串
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="JavaScript/JavaScript_6.html">
            
                
                    <a href="../JavaScript/JavaScript_6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        第6章：循环与流程控制
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="5.7" data-path="JavaScript/JavaScript_7.html">
            
                
                    <a href="../JavaScript/JavaScript_7.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        第7章：函数与作用域
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="JavaScript/JavaScript_8.html">
            
                
                    <a href="../JavaScript/JavaScript_8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.8.</b>
                        
                        第8章：String方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.9" data-path="JavaScript/JavaScript_9.html">
            
                
                    <a href="../JavaScript/JavaScript_9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.9.</b>
                        
                        第9章：数组方法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.10" data-path="JavaScript/JavaScript_10.html">
            
                
                    <a href="../JavaScript/JavaScript_10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.10.</b>
                        
                        第10章：定时器与排序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.11" data-path="JavaScript/JavaScript_11.html">
            
                
                    <a href="../JavaScript/JavaScript_11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.11.</b>
                        
                        第11章：Date与Math
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.12" data-path="JavaScript/JavaScript_12.html">
            
                
                    <a href="../JavaScript/JavaScript_12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.12.</b>
                        
                        第12章：简单的DOM操作与垃圾回收
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.13" data-path="JavaScript/JavaScript_13.html">
            
                
                    <a href="../JavaScript/JavaScript_13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.13.</b>
                        
                        第13章：DOM操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.14" data-path="JavaScript/JavaScript_14.html">
            
                
                    <a href="../JavaScript/JavaScript_14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.14.</b>
                        
                        第14章：DOM修改样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.15" data-path="JavaScript/JavaScript_15.html">
            
                
                    <a href="../JavaScript/JavaScript_15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.15.</b>
                        
                        第15章：DOM常用标签属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.16" data-path="JavaScript/JavaScript_16.html">
            
                
                    <a href="../JavaScript/JavaScript_16.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.16.</b>
                        
                        第16章：鼠标坐标与拖拽
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >MarkDown的使用</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x51FD;&#x6570;&#x4E0E;&#x4F5C;&#x7528;&#x57DF;">&#x51FD;&#x6570;&#x4E0E;&#x4F5C;&#x7528;&#x57DF;</h1>
<h3 id="&#x51FD;&#x6570;">&#x51FD;&#x6570;</h3>
<pre><code>            /**
             * &#x51FD;&#x6570;&#xFF1A;
             *         &#x58F0;&#x660E;&#xFF1A;&#x5177;&#x6709;&#x58F0;&#x660E;&#x63D0;&#x524D;&#x7684;&#x529F;&#x80FD;
             *         &#x53C2;&#x6570;&#xFF1A;&#x5F62;&#x53C2;&#x548C;&#x5B9E;&#x53C2;&#x5176;&#x5B9E;&#x662F;&#x4E24;&#x4E2A;&#x72EC;&#x7ACB;&#x7684;&#x4E2A;&#x4F53;&#xFF0C;&#x6240;&#x4EE5;&#x547D;&#x540D;&#x53EF;&#x4EE5;&#x91CD;&#x540D;
             *               arguments&#x662F;&#x51FD;&#x6570;&#x5185;&#x4E00;&#x4E2A;&#x63A5;&#x53D7;&#x53C2;&#x6570;&#x4F20;&#x5165;&#x7684;&#x5217;&#x8868;
             *                 &#x51FD;&#x6570;&#x88AB;&#x8C03;&#x7528;&#x65F6;&#xFF0C;&#x5F62;&#x53C2;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;arguments&#x81EA;&#x52A8;&#x58F0;&#x660E;&#x5F62;&#x53C2;&#x540D;&#x5B57;&#x5E76;&#x4E14;&#x8D4B;&#x503C;
             * */

            add(1,2,3);
            function add(a,b){
                var a , b;
                if(arguments[0]){
                    a = arguments[0];
                }
                if(arguments[1]){
                    b = arguments[1];
                }
                if(arguments[2]){
                    c = arguments[2];
                }
                console.log(a+b,c,arguments)
                return a+b;
            }

            function html(){
                console.log(arguments.length)
                if(arguments.length == 0){
                    // &#x83B7;&#x53D6;&#x529F;&#x80FD;
                }
                if(arguments.length == 1){
                    // &#x66FF;&#x6362;&#x529F;&#x80FD;
                }
            }
            html();


            //&#x7EC3;&#x4E60;:&#x52A0;&#x6CD5;&#x51FD;&#x6570;&#x53C2;&#x6570;&#x662F;&#x4E0D;&#x5B9A;&#x9879;
            function addMore(){
                var result = 0;
                // &#x91CD;&#x590D;&#x7ED9;&#x7ED3;&#x679C;&#x6DFB;&#x52A0;&#x4F20;&#x5165;&#x53C2;&#x6570;&#x7684;&#x503C;&#xFF0C;&#x6B21;&#x6570;&#x7531;&#x4F20;&#x5165;&#x53C2;&#x6570;&#x7684;&#x4E2A;&#x6570;&#x51B3;&#x5B9A;
                for(var i = 0; i &lt; arguments.length; i++){
                    result += arguments[i];
                }

                return result;
            }
            addMore(1,2,3,4);
</code></pre><h3 id="&#x4F5C;&#x7528;&#x57DF;">&#x4F5C;&#x7528;&#x57DF;</h3>
<pre><code>
            // &#x5168;&#x5C40;&#x4F5C;&#x7528;&#x57DF;        &#x6D4F;&#x89C8;&#x5668;&#xFF1A;window        node:global
            var a = 1;
            window.a = 100;
            function funArea(){
                var a = 10;                    //&#x51FD;&#x6570;&#x4F5C;&#x7528;&#x57DF;
                console.log(&quot;a&#x7684;&#x503C;&quot;,a)
            }
            funArea();
            console.log(&quot;a&#x7684;&#x503C;&quot;,a)


            var aaa;
            console.log(aaa)
            var aaa = &quot;123&quot;;        
            /**
             * var
             *     &#x58F0;&#x660E;&#x63D0;&#x524D;&#xFF1A;&#x5148;&#x7ED9;&#x8FD9;&#x4E9B;&#x53D8;&#x91CF;&#x5F00;&#x8F9F;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#xFF0C;&#x5C3D;&#x7BA1;&#x4ED6;&#x7684;&#x503C;&#x662F;undefined
             *     &#x5141;&#x8BB8;&#x91CD;&#x590D;&#x7684;&#x58F0;&#x660E;
             * */ 

            // ES6
            /**
             * let 
             *     &#x4E0D;&#x5141;&#x8BB8;&#x91CD;&#x590D;&#x58F0;&#x660E;
             *     &#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;,&#x53EF;&#x4EE5;&#x8FD0;&#x7528;&#x5728;&#x4E00;&#x4E9B;&#x6CA1;&#x6709;&#x72EC;&#x7ACB;&#x4F5C;&#x7528;&#x57DF;&#x7684;&#x4EE3;&#x7801;&#x5757;&#x91CC;&#xFF0C;&#x4F8B;&#x5982;for
             * */
//            let aaa = &quot;789&quot;;
            var i = 10;
            for(let i = 0; i &lt; 2; i++){
                // for &#x5185;&#x4F7F;&#x7528;&#x7684;i&#x662F;&#x4E00;&#x4E2A;&#x5757;&#x7EA7;&#x4F5C;&#x7528;&#x57DF;&#x91CC;&#x7684;i
                console.log(&quot;for:&quot;,i)
            }
            // window.i
            console.log(i)


            /**
             * const &#x58F0;&#x660E;&#x5E38;&#x91CF;
             *         1.&#x548C;let&#x4E00;&#x6837;&#x4E0D;&#x53EF;&#x91CD;&#x590D;&#x58F0;&#x660E;
             *         2.&#x5728;&#x58F0;&#x660E;&#x7684;&#x540C;&#x65F6;&#x5FC5;&#x987B;&#x8D4B;&#x503C;
             *         3.&#x58F0;&#x660E;&#x540E;&#x4E0D;&#x53EF;&#x518D;&#x8D4B;&#x503C;
             * */ 
            const bbb = 1000;
            function people(name,age){
                const sex = &quot;man&quot;;
                if( name == undefined ){
                    alert(&quot;name&#x503C;&#x662F;&#x5FC5;&#x586B;&quot;);
                    return;
                }
                if( age == undefined ){
                    age = 18;                //&#x9ED8;&#x8BA4;&#x503C;
                }
            }
            people();
</code></pre><h3 id="&#x51FD;&#x6570;&#x7684;&#x8865;&#x5145;">&#x51FD;&#x6570;&#x7684;&#x8865;&#x5145;</h3>
<pre><code>            // &#x547D;&#x540D;&#x51FD;&#x6570;
            function reduce(){

            }

            // &#x51FD;&#x6570;&#x7684;&#x8868;&#x8FBE;&#x5F0F;
            // &#x53D8;&#x91CF;&#x63A5;&#x6536;&#x4E86;&#x4E00;&#x4E2A;&#x533F;&#x540D;&#x51FD;&#x6570;
            var add = function (){
                console.log(123)
            }
            add();

            // &#x547D;&#x540D;&#x51FD;&#x6570;&#x8868;&#x8FBE;&#x5F0F;
            // xyz&#x51FD;&#x6570;&#x5F53;&#x524D;&#x7684;&#x5BB9;&#x5668;&#x662F;abc
            // &#x51FD;&#x6570;&#x7684;&#x540D;&#x5B57;&#xFF1F;
            var abc = function xyz(){
                console.log(xyz)
            }
            abc();
//            console.log( abc , xyz )

            // return &#x8FD4;&#x56DE;&#x503C;,&#x4E2D;&#x65AD;&#x51FD;&#x6570;&#x7684;&#x8FD0;&#x884C;


            /**
             * try{
             *         &#x6267;&#x884C;&#x4EE3;&#x7801;
             * }catch(e){
             *         &#x6355;&#x83B7;&#x9519;&#x8BEF;
             *         e&#x4EE3;&#x8868;&#x9519;&#x8BEF;
             *         &#x5177;&#x6709;&#x72EC;&#x7ACB;&#x7684;&#x4F5C;&#x7528;&#x57DF;
             * }
             * console.warn()            // &#x6253;&#x5370;&#x8B66;&#x544A;
             * console.error()            // &#x6253;&#x5370;&#x9519;&#x8BEF;
             * new Error(&quot;&#x62A5;&#x9519;&#x63D0;&#x793A;&quot;)
             * */

            // &#x4E3B;&#x52A8;&#x629B;&#x51FA;&#x9519;&#x8BEF;
//            throw new Error(&quot;test error&quot;);

            var e = 1;
            try{
                console.log( &quot;try&quot; , xyz )
            }catch(e){
                // &#x5982;&#x679C;try&#x4E2D;&#x6CA1;&#x6709;&#x9519;&#x8BEF;&#xFF0C;&#x5219;&#x4E0D;&#x4F1A;&#x6267;&#x884C;
                var err = new Error(&quot;xyz&#x6CA1;&#x6709;&#x6302;&#x8F7D;&#x5728;&#x5168;&#x5C40;&#x4E0A;&quot;);
                console.error( err )
                console.log(e)
            }finally{
                // &#x6700;&#x540E;&#x4E00;&#x6B65;
                console.log(&quot;finally&quot;,e)
            }
            console.log( &quot;&#x6700;&#x540E;&quot; )
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../JavaScript/JavaScript_6.html" class="navigation navigation-prev " aria-label="Previous page: 第6章：循环与流程控制"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../JavaScript/JavaScript_8.html" class="navigation navigation-next " aria-label="Next page: 第8章：String方法"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
